import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/application/env_company_tree_entity.dart';
import 'package:safetymonitor/app/data/common/choice_bean.dart';


EnvCompanyTreeEntity $EnvCompanyTreeEntityFromJson(Map<String, dynamic> json) {
  final EnvCompanyTreeEntity envCompanyTreeEntity = EnvCompanyTreeEntity();
  final dynamic id = json['id'];
  if (id != null) {
    envCompanyTreeEntity.id = id;
  }
  final int? nodeId = jsonConvert.convert<int>(json['nodeId']);
  if (nodeId != null) {
    envCompanyTreeEntity.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    envCompanyTreeEntity.nodeName = nodeName;
  }
  final dynamic thresholdVal = json['thresholdVal'];
  if (thresholdVal != null) {
    envCompanyTreeEntity.thresholdVal = thresholdVal;
  }
  final dynamic categoryEn = json['categoryEn'];
  if (categoryEn != null) {
    envCompanyTreeEntity.categoryEn = categoryEn;
  }
  final int? nodeType = jsonConvert.convert<int>(json['nodeType']);
  if (nodeType != null) {
    envCompanyTreeEntity.nodeType = nodeType;
  }
  final List<EnvCompanyTreeChildren>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<EnvCompanyTreeChildren>(e) as EnvCompanyTreeChildren).toList();
  if (children != null) {
    envCompanyTreeEntity.children = children;
  }
  final dynamic systemType = json['systemType'];
  if (systemType != null) {
    envCompanyTreeEntity.systemType = systemType;
  }
  final int? companyType = jsonConvert.convert<int>(json['companyType']);
  if (companyType != null) {
    envCompanyTreeEntity.companyType = companyType;
  }
  final dynamic sort = json['sort'];
  if (sort != null) {
    envCompanyTreeEntity.sort = sort;
  }
  final dynamic queryParams = json['queryParams'];
  if (queryParams != null) {
    envCompanyTreeEntity.queryParams = queryParams;
  }
  final bool? isChecked = jsonConvert.convert<bool>(json['isChecked']);
  if (isChecked != null) {
    envCompanyTreeEntity.isChecked = isChecked;
  }
  return envCompanyTreeEntity;
}

Map<String, dynamic> $EnvCompanyTreeEntityToJson(EnvCompanyTreeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['thresholdVal'] = entity.thresholdVal;
  data['categoryEn'] = entity.categoryEn;
  data['nodeType'] = entity.nodeType;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  data['systemType'] = entity.systemType;
  data['companyType'] = entity.companyType;
  data['sort'] = entity.sort;
  data['queryParams'] = entity.queryParams;
  data['isChecked'] = entity.isChecked;
  return data;
}

extension EnvCompanyTreeEntityExtension on EnvCompanyTreeEntity {
  EnvCompanyTreeEntity copyWith({
    dynamic id,
    int? nodeId,
    String? nodeName,
    dynamic thresholdVal,
    dynamic categoryEn,
    int? nodeType,
    List<EnvCompanyTreeChildren>? children,
    dynamic systemType,
    int? companyType,
    dynamic sort,
    dynamic queryParams,
    bool? isChecked,
  }) {
    return EnvCompanyTreeEntity()
      ..id = id ?? this.id
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..thresholdVal = thresholdVal ?? this.thresholdVal
      ..categoryEn = categoryEn ?? this.categoryEn
      ..nodeType = nodeType ?? this.nodeType
      ..children = children ?? this.children
      ..systemType = systemType ?? this.systemType
      ..companyType = companyType ?? this.companyType
      ..sort = sort ?? this.sort
      ..queryParams = queryParams ?? this.queryParams
      ..isChecked = isChecked ?? this.isChecked;
  }
}

EnvCompanyTreeChildren $EnvCompanyTreeChildrenFromJson(Map<String, dynamic> json) {
  final EnvCompanyTreeChildren envCompanyTreeChildren = EnvCompanyTreeChildren();
  final dynamic id = json['id'];
  if (id != null) {
    envCompanyTreeChildren.id = id;
  }
  final int? nodeId = jsonConvert.convert<int>(json['nodeId']);
  if (nodeId != null) {
    envCompanyTreeChildren.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    envCompanyTreeChildren.nodeName = nodeName;
  }
  final dynamic thresholdVal = json['thresholdVal'];
  if (thresholdVal != null) {
    envCompanyTreeChildren.thresholdVal = thresholdVal;
  }
  final dynamic categoryEn = json['categoryEn'];
  if (categoryEn != null) {
    envCompanyTreeChildren.categoryEn = categoryEn;
  }
  final int? nodeType = jsonConvert.convert<int>(json['nodeType']);
  if (nodeType != null) {
    envCompanyTreeChildren.nodeType = nodeType;
  }
  final List<EnvCompanyTreeChildrenChildren>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<EnvCompanyTreeChildrenChildren>(e) as EnvCompanyTreeChildrenChildren).toList();
  if (children != null) {
    envCompanyTreeChildren.children = children;
  }
  final int? systemType = jsonConvert.convert<int>(json['systemType']);
  if (systemType != null) {
    envCompanyTreeChildren.systemType = systemType;
  }
  final dynamic companyType = json['companyType'];
  if (companyType != null) {
    envCompanyTreeChildren.companyType = companyType;
  }
  final dynamic sort = json['sort'];
  if (sort != null) {
    envCompanyTreeChildren.sort = sort;
  }
  final dynamic queryParams = json['queryParams'];
  if (queryParams != null) {
    envCompanyTreeChildren.queryParams = queryParams;
  }
  final bool? isChecked = jsonConvert.convert<bool>(json['isChecked']);
  if (isChecked != null) {
    envCompanyTreeChildren.isChecked = isChecked;
  }
  return envCompanyTreeChildren;
}

Map<String, dynamic> $EnvCompanyTreeChildrenToJson(EnvCompanyTreeChildren entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['thresholdVal'] = entity.thresholdVal;
  data['categoryEn'] = entity.categoryEn;
  data['nodeType'] = entity.nodeType;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  data['systemType'] = entity.systemType;
  data['companyType'] = entity.companyType;
  data['sort'] = entity.sort;
  data['queryParams'] = entity.queryParams;
  data['isChecked'] = entity.isChecked;
  return data;
}

extension EnvCompanyTreeChildrenExtension on EnvCompanyTreeChildren {
  EnvCompanyTreeChildren copyWith({
    dynamic id,
    int? nodeId,
    String? nodeName,
    dynamic thresholdVal,
    dynamic categoryEn,
    int? nodeType,
    List<EnvCompanyTreeChildrenChildren>? children,
    int? systemType,
    dynamic companyType,
    dynamic sort,
    dynamic queryParams,
    bool? isChecked,
  }) {
    return EnvCompanyTreeChildren()
      ..id = id ?? this.id
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..thresholdVal = thresholdVal ?? this.thresholdVal
      ..categoryEn = categoryEn ?? this.categoryEn
      ..nodeType = nodeType ?? this.nodeType
      ..children = children ?? this.children
      ..systemType = systemType ?? this.systemType
      ..companyType = companyType ?? this.companyType
      ..sort = sort ?? this.sort
      ..queryParams = queryParams ?? this.queryParams
      ..isChecked = isChecked ?? this.isChecked;
  }
}

EnvCompanyTreeChildrenChildren $EnvCompanyTreeChildrenChildrenFromJson(Map<String, dynamic> json) {
  final EnvCompanyTreeChildrenChildren envCompanyTreeChildrenChildren = EnvCompanyTreeChildrenChildren();
  final dynamic id = json['id'];
  if (id != null) {
    envCompanyTreeChildrenChildren.id = id;
  }
  final int? nodeId = jsonConvert.convert<int>(json['nodeId']);
  if (nodeId != null) {
    envCompanyTreeChildrenChildren.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    envCompanyTreeChildrenChildren.nodeName = nodeName;
  }
  final dynamic thresholdVal = json['thresholdVal'];
  if (thresholdVal != null) {
    envCompanyTreeChildrenChildren.thresholdVal = thresholdVal;
  }
  final dynamic categoryEn = json['categoryEn'];
  if (categoryEn != null) {
    envCompanyTreeChildrenChildren.categoryEn = categoryEn;
  }
  final int? nodeType = jsonConvert.convert<int>(json['nodeType']);
  if (nodeType != null) {
    envCompanyTreeChildrenChildren.nodeType = nodeType;
  }
  final List<EnvCompanyTreeChildrenChildrenChildren>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<EnvCompanyTreeChildrenChildrenChildren>(e) as EnvCompanyTreeChildrenChildrenChildren).toList();
  if (children != null) {
    envCompanyTreeChildrenChildren.children = children;
  }
  final dynamic systemType = json['systemType'];
  if (systemType != null) {
    envCompanyTreeChildrenChildren.systemType = systemType;
  }
  final dynamic companyType = json['companyType'];
  if (companyType != null) {
    envCompanyTreeChildrenChildren.companyType = companyType;
  }
  final dynamic sort = json['sort'];
  if (sort != null) {
    envCompanyTreeChildrenChildren.sort = sort;
  }
  final dynamic queryParams = json['queryParams'];
  if (queryParams != null) {
    envCompanyTreeChildrenChildren.queryParams = queryParams;
  }
  final bool? isChecked = jsonConvert.convert<bool>(json['isChecked']);
  if (isChecked != null) {
    envCompanyTreeChildrenChildren.isChecked = isChecked;
  }
  return envCompanyTreeChildrenChildren;
}

Map<String, dynamic> $EnvCompanyTreeChildrenChildrenToJson(EnvCompanyTreeChildrenChildren entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['thresholdVal'] = entity.thresholdVal;
  data['categoryEn'] = entity.categoryEn;
  data['nodeType'] = entity.nodeType;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  data['systemType'] = entity.systemType;
  data['companyType'] = entity.companyType;
  data['sort'] = entity.sort;
  data['queryParams'] = entity.queryParams;
  data['isChecked'] = entity.isChecked;
  return data;
}

extension EnvCompanyTreeChildrenChildrenExtension on EnvCompanyTreeChildrenChildren {
  EnvCompanyTreeChildrenChildren copyWith({
    dynamic id,
    int? nodeId,
    String? nodeName,
    dynamic thresholdVal,
    dynamic categoryEn,
    int? nodeType,
    List<EnvCompanyTreeChildrenChildrenChildren>? children,
    dynamic systemType,
    dynamic companyType,
    dynamic sort,
    dynamic queryParams,
    bool? isChecked,
  }) {
    return EnvCompanyTreeChildrenChildren()
      ..id = id ?? this.id
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..thresholdVal = thresholdVal ?? this.thresholdVal
      ..categoryEn = categoryEn ?? this.categoryEn
      ..nodeType = nodeType ?? this.nodeType
      ..children = children ?? this.children
      ..systemType = systemType ?? this.systemType
      ..companyType = companyType ?? this.companyType
      ..sort = sort ?? this.sort
      ..queryParams = queryParams ?? this.queryParams
      ..isChecked = isChecked ?? this.isChecked;
  }
}

EnvCompanyTreeChildrenChildrenChildren $EnvCompanyTreeChildrenChildrenChildrenFromJson(Map<String, dynamic> json) {
  final EnvCompanyTreeChildrenChildrenChildren envCompanyTreeChildrenChildrenChildren = EnvCompanyTreeChildrenChildrenChildren();
  final dynamic id = json['id'];
  if (id != null) {
    envCompanyTreeChildrenChildrenChildren.id = id;
  }
  final int? nodeId = jsonConvert.convert<int>(json['nodeId']);
  if (nodeId != null) {
    envCompanyTreeChildrenChildrenChildren.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    envCompanyTreeChildrenChildrenChildren.nodeName = nodeName;
  }
  final dynamic thresholdVal = json['thresholdVal'];
  if (thresholdVal != null) {
    envCompanyTreeChildrenChildrenChildren.thresholdVal = thresholdVal;
  }
  final dynamic categoryEn = json['categoryEn'];
  if (categoryEn != null) {
    envCompanyTreeChildrenChildrenChildren.categoryEn = categoryEn;
  }
  final int? nodeType = jsonConvert.convert<int>(json['nodeType']);
  if (nodeType != null) {
    envCompanyTreeChildrenChildrenChildren.nodeType = nodeType;
  }
  final dynamic children = json['children'];
  if (children != null) {
    envCompanyTreeChildrenChildrenChildren.children = children;
  }
  final dynamic systemType = json['systemType'];
  if (systemType != null) {
    envCompanyTreeChildrenChildrenChildren.systemType = systemType;
  }
  final dynamic companyType = json['companyType'];
  if (companyType != null) {
    envCompanyTreeChildrenChildrenChildren.companyType = companyType;
  }
  final dynamic sort = json['sort'];
  if (sort != null) {
    envCompanyTreeChildrenChildrenChildren.sort = sort;
  }
  final EnvCompanyTreeChildrenChildrenChildrenQueryParams? queryParams = jsonConvert.convert<EnvCompanyTreeChildrenChildrenChildrenQueryParams>(json['queryParams']);
  if (queryParams != null) {
    envCompanyTreeChildrenChildrenChildren.queryParams = queryParams;
  }
  final bool? isChecked = jsonConvert.convert<bool>(json['isChecked']);
  if (isChecked != null) {
    envCompanyTreeChildrenChildrenChildren.isChecked = isChecked;
  }
  return envCompanyTreeChildrenChildrenChildren;
}

Map<String, dynamic> $EnvCompanyTreeChildrenChildrenChildrenToJson(EnvCompanyTreeChildrenChildrenChildren entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['thresholdVal'] = entity.thresholdVal;
  data['categoryEn'] = entity.categoryEn;
  data['nodeType'] = entity.nodeType;
  data['children'] = entity.children;
  data['systemType'] = entity.systemType;
  data['companyType'] = entity.companyType;
  data['sort'] = entity.sort;
  data['queryParams'] = entity.queryParams?.toJson();
  data['isChecked'] = entity.isChecked;
  return data;
}

extension EnvCompanyTreeChildrenChildrenChildrenExtension on EnvCompanyTreeChildrenChildrenChildren {
  EnvCompanyTreeChildrenChildrenChildren copyWith({
    dynamic id,
    int? nodeId,
    String? nodeName,
    dynamic thresholdVal,
    dynamic categoryEn,
    int? nodeType,
    dynamic children,
    dynamic systemType,
    dynamic companyType,
    dynamic sort,
    EnvCompanyTreeChildrenChildrenChildrenQueryParams? queryParams,
    bool? isChecked,
  }) {
    return EnvCompanyTreeChildrenChildrenChildren()
      ..id = id ?? this.id
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..thresholdVal = thresholdVal ?? this.thresholdVal
      ..categoryEn = categoryEn ?? this.categoryEn
      ..nodeType = nodeType ?? this.nodeType
      ..children = children ?? this.children
      ..systemType = systemType ?? this.systemType
      ..companyType = companyType ?? this.companyType
      ..sort = sort ?? this.sort
      ..queryParams = queryParams ?? this.queryParams
      ..isChecked = isChecked ?? this.isChecked;
  }
}

EnvCompanyTreeChildrenChildrenChildrenQueryParams $EnvCompanyTreeChildrenChildrenChildrenQueryParamsFromJson(Map<String, dynamic> json) {
  final EnvCompanyTreeChildrenChildrenChildrenQueryParams envCompanyTreeChildrenChildrenChildrenQueryParams = EnvCompanyTreeChildrenChildrenChildrenQueryParams();
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.companyId = companyId;
  }
  final int? systemId = jsonConvert.convert<int>(json['systemId']);
  if (systemId != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.systemId = systemId;
  }
  final String? systemCode = jsonConvert.convert<String>(json['systemCode']);
  if (systemCode != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.systemCode = systemCode;
  }
  final String? deviceCode = jsonConvert.convert<String>(json['deviceCode']);
  if (deviceCode != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.deviceCode = deviceCode;
  }
  final String? queryStartTime = jsonConvert.convert<String>(json['queryStartTime']);
  if (queryStartTime != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.queryStartTime = queryStartTime;
  }
  final String? queryEndTime = jsonConvert.convert<String>(json['queryEndTime']);
  if (queryEndTime != null) {
    envCompanyTreeChildrenChildrenChildrenQueryParams.queryEndTime = queryEndTime;
  }
  return envCompanyTreeChildrenChildrenChildrenQueryParams;
}

Map<String, dynamic> $EnvCompanyTreeChildrenChildrenChildrenQueryParamsToJson(EnvCompanyTreeChildrenChildrenChildrenQueryParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyId'] = entity.companyId;
  data['systemId'] = entity.systemId;
  data['systemCode'] = entity.systemCode;
  data['deviceCode'] = entity.deviceCode;
  data['queryStartTime'] = entity.queryStartTime;
  data['queryEndTime'] = entity.queryEndTime;
  return data;
}

extension EnvCompanyTreeChildrenChildrenChildrenQueryParamsExtension on EnvCompanyTreeChildrenChildrenChildrenQueryParams {
  EnvCompanyTreeChildrenChildrenChildrenQueryParams copyWith({
    int? companyId,
    int? systemId,
    String? systemCode,
    String? deviceCode,
    String? queryStartTime,
    String? queryEndTime,
  }) {
    return EnvCompanyTreeChildrenChildrenChildrenQueryParams()
      ..companyId = companyId ?? this.companyId
      ..systemId = systemId ?? this.systemId
      ..systemCode = systemCode ?? this.systemCode
      ..deviceCode = deviceCode ?? this.deviceCode
      ..queryStartTime = queryStartTime ?? this.queryStartTime
      ..queryEndTime = queryEndTime ?? this.queryEndTime;
  }
}